package vng.wcc.sonph.LauncherGenerator;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Window;
import android.widget.LinearLayout;

public abstract class LauncherWithTabsGenerator extends Activity {

	private LauncherViewWithTabs mainView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}

	/**
	 * Create the main view - a screen with items to launch and a tab for page control
	 * @param items contains information about the items to be displayed (icon,title and intent to launch)
	 * @param tabData contains information about the items to be displayed on the tab (icon,highlight icon)
	 * @param numColsPerPage number of columns per row on each page
	 * @throws Exception an exception will be thrown if the number of pages doesn't equal to number if tabs
	 */
	protected void createLauncherWithTabView(CellInfo[][] items,TabCellInfo[] tabData,int numColsPerPage) throws Exception {
		this.mainView = new LauncherViewWithTabs(this, items, tabData, new Formatter(this, numColsPerPage), numColsPerPage);		
	}

	public LinearLayout getRootView() {
		return this.mainView;
	}

}
